package com.tian.core.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.struts2.json.annotations.JSON;

/**
 * Depart entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "depart", catalog = "portalservermond")
public class Depart implements java.io.Serializable {

	// Fields

	private Integer id;
	private String deptname;
	private Integer pid;
	private Set<Master> masters = new HashSet<Master>(0);

	// Constructors

	/** default constructor */
	public Depart() {
	}

	/** full constructor */
	public Depart(String deptname, Integer pid, Set<Master> masters) {
		this.deptname = deptname;
		this.pid = pid;
		this.masters = masters;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "deptname", length = 100)
	public String getDeptname() {
		return this.deptname;
	}

	public void setDeptname(String deptname) {
		this.deptname = deptname;
	}

	@Column(name = "pid")
	public Integer getPid() {
		return this.pid;
	}

	public void setPid(Integer pid) {
		this.pid = pid;
	}
	@JSON(serialize = false)
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "depart")
	public Set<Master> getMasters() {
		return this.masters;
	}

	public void setMasters(Set<Master> masters) {
		this.masters = masters;
	}

}